import 'package:flutter/material.dart';
import 'package:first_flutter_demo/home/OtherPage.dart';
import 'package:first_flutter_demo/home/TabOne.dart';
import 'package:first_flutter_demo/home/TabTwoPage.dart';
import 'package:first_flutter_demo/home/TabThreePage.dart';
import 'package:first_flutter_demo/home/TabFourPage.dart';

class HomePage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return new HomePageState();
  }
}

class HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    return new DefaultTabController(
        length: 4,
        child: new Scaffold(
          appBar: new AppBar(
            backgroundColor: Colors.black45,
            // title: titleWidget(),
            title: new Text(
              "首页",
              style: new TextStyle(color: Colors.white, fontSize: 22.00),
            ),
            actions: <Widget>[
              new IconButton(
                  icon: new Icon(Icons.add_a_photo),
                  onPressed: () {
                    Navigator.of(context)
                        .push(new MaterialPageRoute(builder: (context) {
                      return new OtherPage();
                    }));
                  })
            ],
            bottom: new TabBar(
                isScrollable: true,
                labelStyle: new TextStyle(fontSize: 22.00, color: Colors.red),
                indicatorPadding: EdgeInsets.zero,
                labelColor: Colors.white,
                indicatorWeight: 4.0,
                unselectedLabelColor: Colors.blueAccent,
                tabs: [
                  new Tab(
                    text: "豆瓣电影",
                  ),
                  new Tab(
                    text: "控件摆放",
                  ),
                  new Tab(
                    text: "列表展示",
                  ),
                  new Tab(
                    text: "其他控件展示",
                  ),
                ]),
          ),
          body: new TabBarView(children: [
            new TabOne(),
            new TabTwoPage(),
            new TabThreePage(),
            new TabFourPage()
          ]),
        ));
  }
}
